package com.zzxy.service.impl;

import com.zzxy.dao.IAccountDao;
import com.zzxy.service.IAccountService;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


public class AccountServiceImpl implements IAccountService {
    private IAccountDao accountDao;

    public IAccountDao getAccountDao() {

        return accountDao;
    }

    public void setAccountDao(IAccountDao accountDao) {

        this.accountDao = accountDao;
    }

    @Override
    public void out(String outer, int money) {
        accountDao.out(outer, money);

    }
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
    @Override
    public void transer(String outer, String inner, int money) {
        accountDao.in(inner , money);
        accountDao.out(outer , money);
    }
    @Override
    public void in(String inner, int money) {

        accountDao.in(inner, money);
    }

}
